<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./templates/template_general.xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:define name="title">
        Ajout d'une enseigne
    </ui:define>

    <ui:define name="content">

        <c:if test="#{utilisateurMBean.estAdmin() || utilisateurMBean.estCommercant()}">
            <div class="profil_enseigne">
                <p:panel header="Ajout d'une enseigne" style="text-align:center;width: 100%">
                    <h:form>
                        <p:messages showDetail="true" id="log" globalOnly="true" autoUpdate="false"/>
                        <h:panelGrid styleClass="panelgrid_enseigne_info" columns="2" style="width:100%;">
                            <h:outputLabel value="Nom :" for="nom"/>
                            <p:inputText size="30" id="nom" title="nom" value="#{nom}"/>

                            <h:outputLabel value="Description :" for="description"/>
                            <p:inputTextarea id="description" title="description" value="#{description}"/>

                            <h:outputLabel value="Adresse :" for="adresse"/>
                            <p:inputText size="30" id="adresse" title="adresse" value="#{adresse}"/>

                            <h:outputLabel value="Ville :" for="ville"/>
                            <p:inputText size="30" id="ville" title="ville" value="#{ville}"/>

                            <h:outputLabel value="Pays :" for="pays"/>
                            <p:inputText size="30" id="pays" title="pays" value="#{pays}"/>

                            <h:outputLabel value="Type" for="type"/>
                            <p:selectOneMenu value="#{type}">
                                <f:selectItem itemLabel="Restaurant" itemValue="1" />
                            </p:selectOneMenu>

                            <p:commandButton id="Ajouter" value="Ajouter" ajax="false" action="#{enseigneMBean.creerEnseigne(nom, description, ville, adresse, pays, type)}"/>
                        </h:panelGrid>
                    </h:form>
                </p:panel>
            </div>
        </c:if>
    </ui:define>

</ui:composition>
